package client;

public class SingleController {

	
	private ISingleConversation sConversation;
	
	public SingleController(ISingleConversation sC) {
		this.sConversation=sC;
	}
		
		
	
	
	public void singleControll(String nick,String read){

		if(read.substring(1, read.indexOf(" ")).equalsIgnoreCase(nick)){
			
			sConversation.generateConversation(read.substring(read.indexOf(" ")+1,read.indexOf(":")-1));
			sConversation.textAppenderSender(read.substring(read.indexOf(" ")+1,read.length()));
			
			return;
			
		}
		
		if(read.substring(read.indexOf(" ")+1,read.indexOf(":")-1).equalsIgnoreCase(nick)){
		
			sConversation.textAppenderReceiver(read.substring(1,read.length()));
			
			return;
		}
	
	}
}
